<?php

namespace app\index\controller;

use think\Controller;

class News extends Controller
{
    public function index()
    {
    	return $this->fetch();
    }

    public function read(){
    	$id = request()->get('id');
    	$news = model('News');
    	$data = $news->getnewdetails($id);
    	if(!isset($data)){
    		return json(['data'=>$news->getError()]);
    	}
    	$this->assign('title',$data[0]['title']);
    	$this->assign('content',$data[0]['content']);
    	return $this->fetch('new');
    }
}